<!--
 * @Descripttion:
 * @version:
 * @Author: cxguo
 * @Date: 2020-08-03 07:51:09
 * @LastEditors: cxguo
 * @LastEditTime: 2020-11-05 16:41:31
-->
<template>
  <div class="wrapper">
    <ChartRound ref="chart" />
  </div>
</template>

<script>
import ChartRound from './chart-round'
import { listStockDataGroupByStore } from '@/api/charts/store.js'

export default {
  components: { ChartRound },
  data() {
    return {}
  },
  mounted() {
    this.initData()
  },
  methods: {
    initData() {
      listStockDataGroupByStore().then(res => {
        if (res.data.flag) {
          const data = res.data.data
          const cData = data.map(item => {
            return {
              value: item.quantity,
              name: item.name
            }
          })
          this.$refs.chart.initChart(cData)
        }
      })
    }
  }
}
</script>

<style scoped>
</style>
